<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

    <body>

        <ui:composition template="./adminTemplate.xhtml">

            <ui:define name="title">
                Driver Payment
            </ui:define>

            <ui:define name="contain">
                <h:form id="form">
                    <p:panel>
                        <h2>Driver list</h2>
                    <p:messages autoUpdate="true" showDetail="true" showSummary="true"></p:messages>
                    <p:dataTable var="pay" value="#{paymentControl.listD}"
                                 paginator="true" rows="10"  
                                 paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                                 rowsPerPageTemplate="5,10,15" id="table-item">                               
                        <p:column>  
                            <f:facet name="header">  
                                ID
                            </f:facet>  
                            <h:outputText value="#{pay.id}" />  
                        </p:column> 
                        <p:column>  
                            <f:facet name="header">  
                                Driver Name
                            </f:facet>  
                            <h:outputText value="#{pay.namD}"/>
                        </p:column> 

                        <p:column>  
                            <f:facet name="header">  
                                Money 
                            </f:facet>  
                            <h:outputText value="#{pay.money}" />  
                        </p:column> 
                        <p:column style="text-align: center">  
                            <f:facet name="header">  
                                ExpirationDate
                            </f:facet>  
                            <h:outputText value="#{pay.expirationDate}" />  
                        </p:column>     
                        <p:column style="text-align: center">  
                            <f:facet name="header">  
                                Status  
                            </f:facet>  
                            <img src="img/#{pay.status}.png" border="0" />  
                        </p:column> 
                        <p:column style="text-align: center;width: 60px">  
                            <f:facet name="header">  
                                Action  
                            </f:facet>  
                            <h:commandLink actionListener="#{paymentBean.edit(pay)}">
                                <img src="img/edit.png" alt="edit"/>
                            </h:commandLink>
                            <p:commandLink action="#{paymentControl.selectedID(pay.id)}" oncomplete="confirmation.show()">
                                <img src="img/delete.png" alt="trash"/>
                            </p:commandLink>
                        </p:column> 
                    </p:dataTable>
                    <p:confirmDialog id="confirmation" message="Are you sure to delete this Enquiry?"  
                                     header="Delete" severity="alert" widgetVar="confirmation" > 
                        <p:commandButton value="Yes Sure" update=":form:table-item" oncomplete="confirmation.hide()"  
                                         actionListener="#{paymentControl.deletePay}" />  
                        <p:commandButton value="Not Yet" onclick="confirmation.hide()" type="button" />   
                    </p:confirmDialog><br></br>
                    <p:panel>
                        ID: <p:inputText value="#{paymentBean.id}"/>
                        <p:selectOneRadio value="#{paymentBean.status}" id="se" label="status">  
                            <f:selectItem itemLabel="Paid" itemValue="true" />  
                            <f:selectItem itemLabel="Unpaid" itemValue="false" />                                       
                        </p:selectOneRadio>
                        <p:commandButton ajax="false" value="Update" actionListener="#{paymentControl.editSubmit()}"/>
                    </p:panel></p:panel><br></br>
                    <p:panel>
                    <h2>Driver Expiration</h2>
                    <p:dataTable var="pay" value="#{paymentControl.listDEx}">                               
                        <p:column>  
                            <f:facet name="header">  
                                ID
                            </f:facet>  
                            <h:outputText value="#{pay.id}" />  
                        </p:column> 
                        <p:column>  
                            <f:facet name="header">  
                                Driver Name
                            </f:facet>  
                            <h:outputText value="#{pay.namD}"/>
                        </p:column> 

                        <p:column>  
                            <f:facet name="header">  
                                Money 
                            </f:facet>  
                            <h:outputText value="#{pay.money}" />  
                        </p:column> 
                        <p:column style="text-align: center">  
                            <f:facet name="header">  
                                ExpirationDate
                            </f:facet>  
                            <h:outputText value="#{pay.expirationDate}" />  
                        </p:column>     
                        <p:column style="text-align: center">  
                            <f:facet name="header">  
                                Status  
                            </f:facet>  
                            <img src="img/#{pay.status}.png" border="0" />  
                        </p:column>                        
                    </p:dataTable>
                    </p:panel>
                </h:form>
            </ui:define>

        </ui:composition>

    </body>
</html>
